Skip to content

feat: editable query results + empty SELECT rendering - #133

Open
Blankll wants to merge 5 commits into
masterfrom
feat/query-result-editability
Open

feat: editable query results + empty SELECT rendering#133
Blankll wants to merge 5 commits into
masterfrom
feat/query-result-editability

Conversation

@Blankll

@Blankll Blankll commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary

Makes query results editable when the SQL maps back to a single base table, and fixes empty SELECT results being misrendered as DML success messages.

Changes

Backend

  • feat(sql-analysis): new analyze_sql_editability_command using sqlparser to classify a SELECT as editable (plain single-table) or non-editable with a machine-readable reason (join/aggregation/cte/union/subquery/no-table/not-select). 16 unit tests.
  • fix(query): empty SELECT results now preserve column names via driver metadata (postgres prepare, mysql query_iter, sqlserver stream columns) so the frontend renders an empty table instead of "row(s) affected".

Frontend

  • feat(query-result): QueryResultPanel analyzes the executed SQL, fetches primary keys for single-table SELECTs, and passes table/schema/pk props to DataGrid — Edit/Duplicate/Delete now work on plain table queries.
  • Non-editable queries surface a specific reason toast (e.g. "Query joins multiple tables") instead of a generic message.
  • fix(queries): executing on an orphaned tab opens a dialog to rebind to the active connection, close the tab, or cancel; tracks lastExecutedSql so the result panel analyzes the actual executed statement, not the whole editor buffer.
  • feat(i18n): per-reason edit-unsupported copy in English and Chinese.

Testing

  • Rust: 333 lib tests pass (incl. 16 new sql_analysis tests), clippy clean for new code
  • Frontend: vue-tsc clean, 519 jest tests pass, eslint clean

Blankll and others added 5 commits August 8, 2026 03:04
Parse a SELECT statement with sqlparser and decide whether its result rows map back to a single base table. Returns table name + schema for plain single-table SELECTs; otherwise a machine-readable non-editable reason the frontend can surface. Registered as analyze_sql_editability_command.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Empty SELECT result sets returned QueryResult with no columns, so the frontend rendered the DML success message instead of an empty table. Use each driver's statement/stream metadata (postgres prepare, mysql query_iter, sqlserver stream columns) so column names survive zero-row results.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
QueryResultPanel analyzes the executed SQL, fetches primary keys for single-table SELECTs, and passes table/schema/pk props to DataGrid so Edit/Duplicate/Delete work. Non-editable queries surface a specific reason (join/aggregation/cte/union) instead of a generic toast. Also declares rowIndex prop on CellContextMenu to silence the Teleport attribute warning.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Executing on an orphaned tab now opens a dialog offering rebind-to-active-connection, close tab, or cancel, instead of silently dropping the query. Add reattachTab to clear the orphan marker, and record lastExecutedSql so the result panel analyzes the actual executed statement rather than the whole editor buffer.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add per-reason copy (not-select/cte/set-operation/aggregation/multiple-sources/no-table/complex-source) plus the execute-orphan dialog strings in English and Chinese.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant